// 用户信息
export interface UserInfo {
  id: string
  name: string
  email: string
  avatar?: string
  phone?: string
  status: 0 | 1 // 0-禁用 1-启用
  isSuper: 0 | 1 // 0-普通用户 1-超级管理员
  createdAt: string
  updatedAt: string
  loginAt?: string
  loginIp?: string
}

// 登录参数
export interface LoginParams {
  email: string
  password: string
  captcha?: string
  remember?: boolean
}

// 登录响应
export interface LoginResponse {
  token: string
  user: UserInfo
  permissions: string[]
  roles: Role[]
}

// 角色信息
export interface Role {
  id: string
  name: string
  slug: string
  description?: string
  permissions: Permission[]
  status: 0 | 1
  createdAt: string
  updatedAt: string
}

// 权限信息
export interface Permission {
  id: string
  name: string
  slug: string
  type: 'menu' | 'button' | 'api'
  method?: string
  route?: string
  description?: string
  parentId?: string
  sort: number
  status: 0 | 1
  createdAt: string
  updatedAt: string
}

// 部门信息
export interface Department {
  id: string
  name: string
  parentId?: string
  sort: number
  description?: string
  status: 0 | 1
  children?: Department[]
  createdAt: string
  updatedAt: string
}

// 管理员信息
export interface AdminUser {
  id: string
  name: string
  email: string
  avatar?: string
  phone?: string
  status: 0 | 1
  isSuper: 0 | 1
  departmentId?: string
  department?: Department
  roles: Role[]
  permissions: string[]
  createdAt: string
  updatedAt: string
  loginAt?: string
  loginIp?: string
}

// 学员信息
export interface Student {
  id: string
  name: string
  email: string
  avatar?: string
  phone?: string
  idCard?: string
  departmentId?: string
  department?: Department
  status: 0 | 1
  isActive: 0 | 1
  createdAt: string
  updatedAt: string
  loginAt?: string
  loginIp?: string
}

// 用户搜索参数
export interface UserSearchParams {
  page: number
  size: number
  keyword?: string
  status?: 0 | 1
  departmentId?: string
  roleId?: string
  startTime?: string
  endTime?: string
}

// 修改密码参数
export interface ChangePasswordParams {
  oldPassword: string
  newPassword: string
  confirmPassword: string
}

// 重置密码参数
export interface ResetPasswordParams {
  userId: string
  newPassword: string
}

// 用户创建参数
export interface CreateUserParams {
  name: string
  email: string
  password: string
  phone?: string
  avatar?: string
  departmentId?: string
  roleIds?: string[]
  status?: 0 | 1
}

// 用户更新参数
export interface UpdateUserParams {
  id: string
  name?: string
  email?: string
  phone?: string
  avatar?: string
  departmentId?: string
  roleIds?: string[]
  status?: 0 | 1
}

// 角色创建参数
export interface CreateRoleParams {
  name: string
  slug: string
  description?: string
  permissionIds: string[]
  status?: 0 | 1
}

// 角色更新参数
export interface UpdateRoleParams {
  id: string
  name?: string
  slug?: string
  description?: string
  permissionIds?: string[]
  status?: 0 | 1
}

// 部门创建参数
export interface CreateDepartmentParams {
  name: string
  parentId?: string
  sort?: number
  description?: string
  status?: 0 | 1
}

// 部门更新参数
export interface UpdateDepartmentParams {
  id: string
  name?: string
  parentId?: string
  sort?: number
  description?: string
  status?: 0 | 1
}

// 用户统计信息
export interface UserStatistics {
  totalUsers: number
  activeUsers: number
  newUsers: number
  onlineUsers: number
  userGrowth: Array<{
    date: string
    count: number
  }>
  departmentDistribution: Array<{
    departmentName: string
    count: number
  }>
  roleDistribution: Array<{
    roleName: string
    count: number
  }>
}